
import java.beans.Statement;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Vector;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class DatenImport
 */
@WebServlet("/DBConnect")
public class DBConnect extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public DBConnect() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		
		System.out.println("Gestartet");
		
		Connection conn = null;
		String sourceURL = "jdbc:h2:~/workspace/StuttgartMonopoly/Monopoly";
		String userName = "root";
		String passwd = "stuttgart";
		
		try {
			Class.forName("org.h2.Driver");
			conn = DriverManager.getConnection(sourceURL, userName, passwd);
			System.out.println("Verbindung hergestellt");
		} catch (Exception e) {
			System.out.println(e);
			System.out.println("Fehler");
		}
		
		//public static Connection.getConnection(sourceURL, userName, passwd);
		
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		
		System.out.println("POST");
		PrintWriter out = response.getWriter();
	}



}

